<!doctype html>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<script src="../assert_selection.js"></script>
<script>
selection_test(
    [
      '<div contenteditable>',
        '<p id="p">',
          'Should be first line of document.<br>',
          '<br>',
          'Another line.',
        '</p>',
        '<p></p>&nbsp;',
        '<p></p>&nbsp;',
        '<p>^***TEST***</p>',
        '<p>|<br></p>',
      '</div>'
    ].join(''),
    selection => {
      const p = selection.document.getElementById("p");
      selection.document.execCommand("Cut");
      selection.collapse(p, 2);
      selection.document.execCommand("Paste");
    },
    [
      '<div contenteditable>',
        '<p id="p">',
          'Should be first line of document.',
          '<br>',
        '</p>',
        '<p>***TEST***</p>',
        '<p>|<br></p>',
        '<p>',
          'Another line.',
        '</p>',
        '<p></p>',
        String.fromCharCode(0xA0),
        '<p></p>',
        String.fromCharCode(0xA0),
        '<p><br></p>',
      '</div>'
    ].join(''),
    '***TEST*** line should be second, following the first line. The test is',
    ' a regression test for rdar://problem/3927554.');
</script>
